<?php
/**
 * devnote-doc
 * @author ice.deng <ice.deng@qq.com>
 *
 */
date_default_timezone_set('PRC');
error_reporting(0);

// 网站根目录
define('WEB_ROOT', __DIR__ . '/');
// 站点根目录
define('APP_ROOT', __DIR__ . '/../');

// 获取配置文件
$config = array_merge(
    require(APP_ROOT . 'config-default.php'),
    require(APP_ROOT . 'config.php')
);

require(APP_ROOT . 'core/Application.php');
require(APP_ROOT . 'core/BaseHandler.php');
require(APP_ROOT . 'core/PhpRenderer.php');
require(APP_ROOT . 'handlers/DefaultHandler.php');
require(APP_ROOT . 'handlers/DocPageHandler.php');

$app = new Application($config);
$app->view = new PhpRenderer($config['view_path'], ['app' => $app, 'ci' => $app->getCi()]);
$app->addRoutes([
    '/' => 'DefaultHandler',
    '/docs/([a-zA-Z0-9-_\/]+)' => 'DocPageHandler',
]);

$app->run();